home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-02-07 | 6.9 KB | 169 lines | [TEXT/MPS ] |
- Macintosh
- Sample Code Notes
- _____________________________________________________________________________
- Developer Technical Support
-
- System Software 7.0b1 Sample Code: ProcDoggie
-
- by Forrest Tanaka
-
- Versions:
- 1.0a3 November 3, 1990
- 1.0a5 December 18, 1990
- 1.0a6 February 7, 1991
-
- Components:
- ProcDoggie.make February 7, 1991
- ProcDoggie.p February 7, 1991
- ProcDoggie.r February 7, 1991
- ProcDoggie.rsrc January 27, 1991
- UDialogUtils.inc1.p February 7, 1991
- UDialogUtils.p February 7, 1991
- UEmergMem.inc1.p February 7, 1991
- UEmergMem.p February 7, 1991
- UGlobals.inc1.p February 7, 1991
- UGlobals.p February 7, 1991
- UMenuHandler.inc1.p February 7, 1991
- UMenuHandler.p February 7, 1991
- UProcessGuts.inc1.p February 7, 1991
- UProcessGuts.p February 7, 1991
- UProcessLDEF.inc1.p February 7, 1991
- UProcessLDEF.p February 7, 1991
- UProcessUtils.inc1.p February 7, 1991
- UProcessUtils.p February 7, 1991
-
- _______________________________________________________________________________
-
- Description
-
- System Software 7.0 includes the Process Manager which allows programs to
- launch applications and desk accessories, and to get information about
- other applications and desk accessores that have been launched (both
- generically known as “processes”).
-
- ProcDoggie is a sample application that demonstrates typical uses of the
- Process Manager. When ProcDoggie is launched, a window appears which
- displays a list of all processes that are active on the machine that
- ProcDoggie is running on. I call this the “Process List window.” The user
- can click on any of the processes in the Process List window to select that
- process, and can shift-click or command-click to select more than one
- process.
-
- When one or more processes are selected, the user can either view
- information about those processes, bring those processes to the front, or
- terminate those processes. Of course, only one process can be at the front
- at any time, so each of the selected processes are brought to the front in
- turn.
-
- When the user chooses to view information about the selected processes, a
- window which I call the “Process Info window” is opened for each of the
- selected processes. This window displays information about the type and
- creator of the process, whether the process is an application or desk
- accessory, how large its partition is, how much memory it’s using, and
- the status of the flags in its SIZE resource.
-
- The File menu contains commands that the user can use to launch
- applications and desk accessories. The user can launch an application or
- desk accessory so that it becomes the front process, or the user can launch
- an application so that it becomes a background process, or the user can
- launch an application or desk accessory and then terminate ProcDoggie.
-
- Additionally, the user can choose whether a simple launch is performed or
- whether the launch should specify documents to be opened or printed by the
- launched application.
-
- Thanks to Jeff Hokit for inspiring the name.
-
-
- Version 1.0a1
- Date unknown by Forrest Tanaka
-
- This version had all features except the ability to terminate processes
- implemented, but very little of the user interface was implemented. Never
- released to AppleLink
-
-
- Version 1.0a2
- Date unknown by Forrest Tanaka
-
- The same features were there, but the user interface was much more complete.
- Never released to AppleLink.
-
- Version 1.0a3
- November 3, 1990 by Forrest Tanaka
-
- This version has features as described above with the exception of being
- able to terminate selected processes. Readied for release on AppleLink on
- November 3.
-
- Version 1.0a4
- No date
-
- This version never existed. I renumbered everything as 1.0a5 by mistake.
-
- Version 1.0a5
- December 18, 1990 by Forrest Tanaka
-
- • The ability to terminate selected processes has been added.
- • Error-checking and recovery has been massively improved. In theory,
- ProcDoggie should never bomb with any kind of error.
- • High-level events are now accepted, though only 'quit' AppleEvents are
- handled because ProcDoggie has no documents.
- • Previously, ProcDoggie didn’t send 'oapp' events to applications which
- were high-level event aware, nor did it properly send 'odoc' events to
- those applications. These problems have been fixed.
- • The Utilities sample code unit is no longer used. All the Utilities
- functionality I was using has been absorbed into ProcDoggie.
- • If an alert is about to be presented while ProcDoggie is in the back-
- ground, the Notification Manager is used to alert the user that
- ProcDoggie has something to say.
- • Readied for release on AppleLink on December 18.
-
- Version 1.0a6
- February 6, 1991 by Forrest Tanaka
-
- • DrawMenuBar bombs after I send a quit event to MacPaint (and a few
- other applications) and then delete the selected row in the process
- list. So I changed the DrawMenuBar call to InvalMenuBar and it seems to
- work around the problem. I don’t know why DrawMenuBar has a problem in
- this specific case involving the Menu, AppleEvent, and List managers.
- • In InstallDialogItems, I was calling GetIndString with an index of 0 if
- there isn’t a specified font name. GetIndString bombs under 7.0b4 if
- you do that so now I check for this case.
- • My LDEF was drawing a cell even if the specified length of the cell’s
- data was 0. That caused garbage to appear in new cells until I set a
- real value in the cell. Now, I don’t draw the cell if the length of the
- cell’s data is 0.
- • I think my LDEF now draws the process names from right aligned on a
- bidirectional script system. Since I don’t have a bidirectional 7.0
- script system, I can’t test this yet.
- • Because of a bug in file filtering in 7.0b1, I used SFGetFile instead of
- StandardGetFile. With 7.0b1 dead and buried, I’m now using
- StandardGetFile.
- • Dammit Jim! I’m a C programmer, not a Pascal programmer. I turned off
- range checking in all the source code files.
- • I eliminated the UWindowHandler unit and moved the routines that were in
- it to ProcDoggie.p and the UGlobals unit.
-
- Coverage
- This sample code additionally shows:
-
- • simple use of the Notification Manager
- • MacApp-like menu enabling and disabling
- • use of the International Utilities to display formatted numbers
- • writing a simple single-line replacement for TextBox
- • how to read a DITL resource
- • use of courteous colors in a palette
- • simple use of MakeRGBPat to display proper colors regardless of the
- depth of a screen
- • simple cases of taking advantage of Color QuickDraw while still running
- on classic QuickDraw machines
- • sending 'oapp' and 'quit' AppleEvents to other applications running on
- the same machine
- • accepting 'quit' AppleEvents
- • simple use of the List Manager
- • writing a custom LDEF
- • using a grow-zone proc to handle low-memory situations
-
- _______________________________________________________________________________
-